﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "产品页面_b_i管理";
}
@using MiniWeb.Core.Dtos
@using MiniWeb.Core.Enums
@using WFramework.Extensions
@using WFramework.MvcPager
@model PagedList<ProductsInfoDto>
<link href="../../Scripts/colorbox/colorbox.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/colorbox/colorbox.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
<script src="../../Scripts/AdminCommon.js" type="text/javascript"></script>
<script src="../../Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $(".box").colorbox({
            iframe: true,
            width: 1000,
            height: 950,
            onClosed: function () {
                window.location.reload();
            }
        });
        loadServer();

        $("#rid").change(function () {
            loadServer();
        });
        function loadServer() {
            var gameid = $('#rid');
            var serverlist = $('#cid');

            var mtid = gameid.val();
            serverlist.empty();

            $.getJSON('@Url.Action("GetClass", "ProductsClassManager")', { tid: mtid }, function (data) {
                $.each(data, function (i, item) {
                    $("<option></option>").val(item["Value"]).text(item["Text"]).appendTo(serverlist);
                });
              
                serverlist.val('@ViewData["cid"]');
            });


        }
        $("#apeizhi").click(function () {
            $.post("/ProductsInfoManager/peizhi", { pid: $(this).attr('pid') }, function (result) {

                $("#apeizhi").html(result.ret);
            });

        });
    });
</script>
<div class="right_box_card">
    <ul>
        <li class="right_box_card1"><a href="@Url.Action("List", "ProductsInfoManager")">产品页面管理</a></li>
    </ul>
</div>
<div style="line-height: 40px;">
    <p class="avatar_btn">
        <a href="@Url.Action("Save", "ProductsInfoManager")"  id="lnkAdd">新增</a>
    </p>
</div>
<div>
    @using (Html.BeginForm("List", "ProductsInfoManager", FormMethod.Get))
    {
        <table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0"
            cellpadding="0">
            <tr height="50">
             <td  colspan="2">商品类别：@Html.DropDownList("rid",ViewData["typelist"] as List<SelectListItem>)
                 @Html.DropDownList("cid",new List<SelectListItem>())
             </td>
             <td>
             商品ID：@Html.TextBox("pid",null, new { @class = "input" })
             </td>
               <td colspan="2">
            添加时间：  @Html.TextBox("startime",null, new { @class = "validate[required] text-input", onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd '})" })
            至  @Html.TextBox("endtime", null,new { @class = "validate[required] text-input", onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd '})" })
            </td>
            
            </tr>
          <tr>
           <td>
             是否上架：@Html.CheckBox("isSell")
             </td>
             <td>
             是否促销：@Html.CheckBox("isChuXiao")
             </td>
             <td>
             是否热点：@Html.CheckBox("isHot")
             </td>
             <td>
             是否显示首页：@Html.CheckBox("isWeb")
             </td>
              <td>
                    <input type="submit" value="查找" class="submit" style="float: left; width: 80px;" />
            </td>
          </tr>
           

           
          
        </table>
    }
</div>
<table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0"
    cellpadding="0">
    <tr height="30" class="tab_title">
        <td>
            ID
        </td>
        <td>
            产品名称
        </td>
        <td>
            实际价格
        </td>
        <td>
            促销价格
        </td>
        <td>
            库存
        </td>
        <td>
            已售
        </td>
        <td>
            总量
        </td>
        <td>
            热销
        </td>
        <td>
            促销
        </td>
        <td>
            显示首页
        </td>
       
        <td>
            添加时间
        </td>
         <td>
            上架
        </td>
        <td>
            操作
        </td>
    </tr>
    @foreach (var item in Model)
    {
        <tr height="35" class="tab_td1">
            <td>
                @item.ID
            </td>
            <td>
                @item.ProductName
            </td>
            <td>
                @item.Price
            </td>
            <td>
                @item.CPrice
            </td>
            <td>
                @item.KuCunNum
            </td>
            <td>
                @item.SellNum
            </td>
            <td>
                @item.TotalNum
            </td>
            <td>
                @MvcHtmlString.Create(item.IsHot ? "<font color ='red'>是</font>" : "否")
            </td>
            <td>
                @MvcHtmlString.Create(item.IsChuXiao ? "<font color ='red'>是</font>" : "否")
            </td>
            <td>
                @MvcHtmlString.Create(item.IsWeb ? "<font color ='red'>是</font>" : "否")
            </td>
           
            <td>
                @item.CreateDate
            </td>
             <td>
                @MvcHtmlString.Create(item.IsSell ? "<a href='javascript:void(0);' id='apeizhi' pid='" + item.ID.ToString() + "'>上架</a>" : "<a href='javascript:void(0);' id='apeizhi' pid='" + item.ID.ToString() + "'>下架</a>")
            </td>
            <td>
                @Html.ActionLink("修改", "Save", "ProductsInfoManager", new { id = item.ID }, new {  })
                 
                 <a href="/ProductsImgInfoManager/List?pid=@item.ID" class="box">轮播图</a>
                <a href="#" onclick="DeletePost('/ProductsInfoManager/Delete', { id: @item.ID})">删除</a>
            </td>
        </tr>
    }
</table>
<div style="padding: 10px;">
    @Html.Pager(Model)
</div>
